<ul>
    <?php
    listCommentSubs($comments);

    function listCommentSubs($comments) {
        global $cquery,$page;
        foreach($comments as $comment) {
     ?>
    <li>
        <h4><?php echo  $comment["user_id"]; ?> wrote : </h4> 
        <h5><?php echo $comment["user_comment_message"]; ?></h5>
        <span ><a href="#add_comment" onclick="setUserComment(<?php echo $comment["user_comment_id"]; ?>,'reply <?php echo  $comment["user_id"]; ?> \'s comment')" class="readmore">reply <?php echo  $comment["user_id"]; ?> 's comment</a></span>
                <?php
                $subComment = $cquery->userSubComment($page,$comment["user_comment_id"]);
                if($subComment->getUnlimitedNumberRows()>0) { ?>
                    <ul class="sub_comment">
                         <?php  listCommentSubs($subComment); ?>
                    </ul>
                    <?php } ?>
    </li>
            <?php
        }
    }
    ?>
</ul>
